<template>
	<view style="height: 100%;">
		<view class="container">
			<view class="text">{{listdata.share_title}}</view>
			<view class="qrcode-icon">
				<image :src="see_qrcode_img" class="qrcode-img"></image>
			</view>
			<view class="text">长按识别小程序码开门</view>
		</view>
	</view>
</template>

<script>
	import uniPopups from "../../../appComponent/uni/uni-popups/uni-popups.vue"
	import xflSelect from '../component/xfl-select/xfl-select.vue';
	var common = require('../../../utils/common.js');
	var app = getApp();
	var _this;
	const getshare = () => {
		common.post('HouseApi&a=house_village_door_share_info', {
			village_id: _this.village_id,
			pigcms_id: _this.pigcms_id,
			door_share_id: _this.door_share_id,
		}, data => {
			console.log('hhhhhhhhh', data)
			_this.listdata = data;
			_this.see_qrcode_img = data.see_qrcode_img;
			
			
		});
	};
	export default {
		data() {
			return {
				listBoxStyle: `height: 50rpx;background-color: rgba(38,129,243,0.2);border-radius: 10rpx;border: 0rpx;`, //下拉选择框样式
				listdata: {},
				actcolor: '',
				btn_style: '',
				visitor_open_img:'',
				share_weixin_info: {},
				door_share_id: '', 
				see_qrcode_img: '',
			}
		},
		onShow() {
			// #ifdef H5
				if(_this.village_id){
					_this.setWxShare()
				}
			// #endif
		},
		onLoad(options) {
			_this = this;
			_this.door_share_id = options.door_share_id
			// #ifdef H5
			console.log('准备跳小程序页', _this);
			common.webToMiniapp(_this.route, options, 'redirect')
			// #endif

			common.setMainColor(_this, function(config) {
				_this.actcolor = config.config.mobile_head_color
				_this.btn_style = 'background-color: ' + _this.actcolor + ';box-shadow:0px 30rpx 30rpx -30rpx ' + _this.actcolor +
					';';
				getshare();
			});
		},
		methods: {
			visibleChange(isShow) { // 列表框的显示隐藏事件
				console.log('isShow::', isShow);
			},
			onShareAppMessage: function () {
				return {
					title: "欢迎来到【" + _this.village_name + "】",
					desc: _this.village_name + "推出最新智慧社区平台，邀您一起来体验",
					path: 'packapp/village/#/pages/village/index/index?village_id=' + _this.village_id
				};
			},
			setWxShare() {
				let pageLink = _this.share_weixin_info.sendFriendLink;
				pageLink = common.addShareParam(pageLink);
				let shareWxLink = pageLink
				var shareData = {
					title: _this.share_weixin_info.tTitle,
					desc: _this.share_weixin_info.tContent,
					sendFriendLink: shareWxLink,
					share_img: _this.share_weixin_info.img,
				}
				console.log('shareData', shareData);
				common.setWxShare(shareData)
			},
			
		},
		components: {
			uniPopups,
			xflSelect
		},
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
	}

	.container {
		margin: 0;
		padding: 0;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		overflow: hidden;
		height: 100%;
	}
	.qrcode-icon {
		width: 425rpx;
		height: 425rpx;
	}
	.qrcode-img {
		width: 100%;
		height: 100%;
	}
	.text {
		margin: 30rpx 100rpx;
		text-align: center;
	}
</style>
